<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org" xmlns:layout="http://www.ultraq.net.nz/web/thymeleaf/layout"
layout:decorator="layout">
  <head>
  	<title>联合推荐</title>
  	<script th:inline="javascript"  type="text/javascript">
  	$(function() {
  		setMenu("联合推荐");
  		var evaluateId = [[${evaluateId}]];
  	  /*  $('.table').on('click', '.edit-button', function(e){
  			if(!confirm("确定要删除这条数据吗？")) return;
  			var id = $(this).parents('tr').children('td').eq(7).text();
  			$.ajax({
  				  url: 'delete',
  				  type: 'POST',
  				  dataType : "json",
  				  data: {
  					  id : id
  				  },
  				  success: function(obj){
  					  if(obj.success){
  						  $("#page").pageReload();
  					  }
  				  }
  				});
  		}); */
  		$('.table').on('click','.userNumber',function(e){
  			var userId = $(this).parents('tr').children('td').eq(0).text();
  			var $form = $('<form>').attr({id : "form",method : "get",action : 'user'});
    	    $form.appendTo($("#modal"));
    	 	$('<input type="hidden">').attr({name : "userId",value : userId }).appendTo($form);
    	 	$('<input type="hidden">').attr({name : "evaluateId",value : evaluateId }).appendTo($form);
    	 	$form.submit();
  		});
 		$("#page").page({url:"getRecommends",data:{evaluateId:evaluateId},success:function(obj){
  			 $.each(obj.obj.content, function(i,v){
  				 v.createdAt = new Date(v.createdAt).Format("yyyy/MM/dd");
  			 });
  			 $("#pageData").loadData(obj.obj);
  		}});	
  	});
  </script>
  	
  </head>
  <body>
	<div layout:fragment="content" class="content" id="modal">
	
	<div class="modal">
	<div class="detail">
		<div class="detail-table">
	   	<h4 class="detail-table-title">联合推荐列表
	   	<span class="detail-table-more"></span>
	   	</h4>
	    <div class="table_list">
              <div class="table-overflow">
              <table class="table table-layout">
                  <thead>
                      <tr>
                          <th width="10%">ID</th>
                          <th width="20%">推荐用户</th>
                          <th width="15%">类型</th>
                          <th width="20%">引荐品牌</th>
                          <th width="20%">添加时间</th>
                          <th width="15%">推荐用户数</th>
                          <!-- <th width="15%">操作</th>
                          <th></th>
                          <td><a class="edit-button right-do">删除</a></td>
						  <td>#{id}#</td> -->
                      </tr>
                  </thead>
                  <tbody>
                  <script type="text/template" id="pageData">
					#for(data:content)#
						<tr>
							<td>#{userId}#</td>
							<td>#{tjName}#</td>
							<td>#{type}#</td>
							<td>#{yjName}#</td>
							<td>#{createdAt}#</td>
							<td class="userNumber"><a href="#">#{userNumber}#</a></td>
						</tr>
					#endfor#
					</script>
                   </tbody>
                </table>
                <div id="page"></div>
            </div>
         </div>
         </div>
	</div>
	</div>

	</div>
  </body>
</html>